<html>
<body>
Reports logging calls that are not surrounded by a guard condition.
The evaluation of a call's arguments can be expensive.
Surrounding a logging call with a guard clause prevents that cost when logging
is disabled for the level used by the logging statement. This is especially useful for the
least serious level (trace, debug, finest) of logging calls, because those are
most often disabled in a production environment.
<p><b>Example:</b></p>
<pre><code lang="java">
  public class TestObject {
    void test(Object object) {
      LOG.debug("some logging " + expensiveCalculation(1));
    }
  }
</code></pre>
<p>After a quick-fix is applied:</p>
<pre><code lang="java">
  public class TestObject {
    void test(Object object) {
      if(LOG.isDebugEnabled()){
        LOG.debug("some logging " + expensiveCalculation(1));
      }
    }
  }
</code></pre>
<p>This inspection supports <em>Log4j2</em> and the <em>SLF4J</em> logging frameworks (except builders).
<!-- tooltip end -->
<p><small>New in 2024.2</small></p>
</body>
</html>